import React from 'react'
import { Cart } from '@nutui/icons-react'

export default function (props) {
    const { _id, title, price, img } = props.data
    const ChildComponent = (msg) => {
        props.onReceiveMessage(msg)
    }
    return (
        <div className="info">
            <img src={img} alt="" />
            <p>{title}</p>
            <p >
                <span className='price'>${price}</span>
                <span className='red' >
                    <Cart onClick={() => { ChildComponent(props.data) }} />
                </span>
            </p>
        </div>
    )
}
